classes = [
    {"name": "Lindy", "age": 25, "grade": "A"},
    {"name": "Jack", "age": 23, "grade": "B"},
    {"name": "Rick", "age": 28, "grade": "B"},
    {"name": "Ting", "age": 20, "grade": "A"},
    {"name": "Wallis", "age": 21, "grade": "A"},
]


# age排序函数
def sort_age(x):
    return x['age']


# age排序
classes.sort(key=lambda x: x['age'])
classes.reverse()
classes.sort(key=sort_age)

# map：age+1
new_age = list(map(lambda x: x['age'] + 1, classes))
for i in range(len(classes)):
    classes[i]["age"] = new_age[i]

# filter过滤
classes = list(filter(lambda x: x['grade'] != 'A', classes))


# 斐波那契
# 斐波那契函数递归工具
def fibonacci_recursion_tool(n):
    print("called")
    if n <= 1:
        return n
    else:
        return fibonacci_recursion_tool(n - 1) + fibonacci_recursion_tool(n - 2)


# 斐波那契函数
def fibonacci_recursion(n):
    fibonacci_list = []
    for i in range(n):
        fibonacci_list.append(fibonacci_recursion_tool(i))
    return fibonacci_list

fibonacci_recursion(10)

